package top.bluesword.laboratory.model;

import jakarta.persistence.CascadeType;
import jakarta.persistence.Embedded;
import jakarta.persistence.Entity;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.OneToMany;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

/**
 * 旅程
 * @author 李林峰
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Entity
public class Journey extends BaseData {

    private String name;

    @OneToMany(orphanRemoval=true,cascade = CascadeType.ALL)
    @JoinColumn(name = "journeyId")
    private List<JourneySegment> segments;

    @Embedded
    private OffsetTimeSpan timeSpan;

}
